package com.app.TCES.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.app.TCES.domain.Class;
import com.app.TCES.domain.Course;
import com.app.TCES.domain.Department;
import com.app.TCES.domain.Student;
import com.app.TCES.domain.Teacher;
import com.app.TCES.domain.TeacherSet;

@Mapper
public interface AdministratorMapper {

	@Select("select * from department")
	List<Department> getDepartment();

	@Select("select * from teacher")
	List<Teacher> getTeacher();

	@Select("select * from course")
	List<Course> getCourse();

	@Select("select * from class")
	List<Class> getClasses();

	@Select("select * from student")
	List<Student> getStudent();

	@Select("select count(*) from teacher")
	int getTeacherCount();

	@Select("select t.tchId,t.tchName,c.courseName,d.deptName from teacher t,course c, teacher_course tc,department d where d.deptId = t.deptId and t.tchId = tc.tchId and tc.courseId = c.courseId limit #{tmp},#{limit} ")
	List<TeacherSet> getTeacherSet(@Param("tmp")int tmp,@Param("limit") Integer limit);

	@Select("select t.tchId,t.tchName,c.courseName,d.deptName from teacher t,course c, teacher_course tc,department d where d.deptId = t.deptId and t.tchId = tc.tchId and tc.courseId = c.courseId and d.deptName = #{deptName} limit #{tmp},#{limit} ")
	List<TeacherSet> getTeacherSet1(@Param("tmp")int tmp, @Param("limit")Integer limit, @Param("deptName")String deptName);
	
	@Select("select * from department")
	List<Department> getDeptName();

	@Select("Select count(*) from teacher t,course c, teacher_course tc,department d where d.deptId = t.deptId and t.tchId = tc.tchId and tc.courseId = c.courseId ")
	int gettol();
	@Select("Select count(*) from teacher t,course c, teacher_course tc,department d where d.deptId = t.deptId and t.tchId = tc.tchId and tc.courseId = c.courseId and deptName = #{deptName}")
	int gettol1(@Param("deptName")String deptName);





}
